<template>
  <TableView
    ref="tableView"
    :table-attrs="{ api: getPage, descs: ['createTime'], payloadStyle: 'body', dicOptions: [] }"
    :form-path="formRoute"
    :search-model="searchForm"
    :delete-api="batchDelete">
    <template #columns>
      <TableColumn label="课题名称" prop="name" clickable />
      <TableColumn label="承担单位" prop="undertakingUnit" />
      <TableColumn label="负责人" prop="masterName" />
      <TableColumn label="总经费 (万元)" prop="funds" />
      <TableColumn label="所属项目名称" prop="projectName" />
      <TableColumn label="备注" prop="remark" />
    </template>
    <template #search-form>
      <FormInput v-model="searchForm.name" label="课题名称" prop="name" />
      <FormInput v-model="searchForm.masterName" label="负责人姓名" prop="masterName" />
      <FormInput v-model="searchForm.projectName" label="所属项目名称" prop="projectName" />
    </template>
  </TableView>
</template>

<script>
  import { getPage, batchDelete } from './api'

  export default {
    name: 'ProjectTopicView',
    data() {
      return {
        searchForm: {
          name: null,
          masterName: null,
          projectName: null
        }
      }
    },
    methods: {
      getPage,
      batchDelete,
      formRoute(item) {
        return `/tech-project/project-manage/topic/ProjectTopicForm/{id:-1}?tabTitle=${item ? '' : '新建'}课题`
      }
    }
  }
</script>
